window.onload = function() {
				setInterval("yidong()", 50);
				for (var i = 0; i < 2; i++) {
					stop = setInterval("createDiv()", 2000);
				}
				width = document.documentElement.clientWidth;
				 height = document.documentElement.clientHeight;
			var beijing=document.getElementById("beijing")
//			beijing.style.height=height+"px"
//			beijing.style.width=width+"px"
			}
			var num = 0;


			function createDiv() {
				//创建div
				if (num < 10) {
					var div = document.createElement("div");
					var i = parseInt(Math.random() * 3);
					div.style.backgroundImage = "url(img/ch" + i + ".png)"
						//									div.setAttribute("x", parseInt(Math.random() * 1000) + 50);
					div.setAttribute("x", 0);
					div.setAttribute("y", 0)
						//				div.setAttribute("rx", parseInt(Math.random() * 15) + 5)
					div.setAttribute("rx", 10)
						//				div.setAttribute("ry", Math.random() * 15 + 10)
					div.setAttribute("ry", 10)
					document.body.appendChild(div);
					num++;
				} else {
					clearInterval(stop);
				}
			}


			function yidong() {
				 width = document.documentElement.clientWidth;
				 height = document.documentElement.clientHeight;
				var divs = document.getElementsByTagName("div");
				for (var i = 0; i < divs.length; i++) {
					var x = parseInt(divs[i].getAttribute("x"));
					var y = parseInt(divs[i].getAttribute("y"));
					var rx = parseInt(divs[i].getAttribute("rx"));
					var ry = parseInt(divs[i].getAttribute("ry"));
					x += rx;
					y += ry;
					//改变div的坐标
					divs[i].style.left = x + "px";
					divs[i].style.top = y + "px";
					//修改div里的X,Y,RX,RY的属性
					//改变方向
					var k = parseInt(Math.random() * 3);
					if (y + 222 + 7 + Math.abs(rx) > height) {
						ry *= -1;
						divs[i].style.backgroundImage = "url(img/ch" + k + ".png)";
					}
					if (x + 222 + 7 + Math.abs(ry) > width) {
						rx *= -1;
						divs[i].style.backgroundImage = "url(img/ch" + k + ".png)";
					}
					if (y < 0) {
						ry *= -1;
						divs[i].style.backgroundImage = "url(img/ch" + k + ".png)";
					}
					if (x < 0) {
						rx *= -1;
						divs[i].style.backgroundImage = "url(img/ch" + k + ".png)";
					}
					//设置DIV的各个属性值
					divs[i].setAttribute("x", x);
					divs[i].setAttribute("y", y);
					divs[i].setAttribute("rx", rx);
					divs[i].setAttribute("ry", ry);
				}
			}
